<?php
/**
 * 天神大模型开源生态社区
 * 基于 Typecho 0.9 系统的默认皮肤修改
 * 
 * @package    天神大模型开源生态社区主题
 * @author      陈祖豪 (Modified by), Typecho Team (Original)
 * @version     1.0.0
 * @link        https://gitee.com/chenran2006/
 * @original    http://typecho.org
 * 
 * 原版权声明：
 * 这是 Typecho 0.9 系统的一套默认皮肤
 * @主题介绍     Typecho Replica Theme 
 * @原作者      Typecho Team
 * @版本号     1.2
 * @链接        http://typecho.org
 */

if (!defined('__TYPECHO_ROOT_DIR__')) exit;
 $this->need('header.php');
 ?>

<div class="main-container">
    <div class="col-mb-12 col-8" id="main" role="main">
        <?php if ($this->options->noticeSwitch == '1' && $this->options->noticeContent): ?>
        <div class="notice-board">
            <div class="notice-content">
                <i class="fas fa-bullhorn"></i>
                <div class="notice-text">
                    <?php echo $this->options->noticeContent; ?>
                </div>
            </div>
        </div>
        <?php endif; ?>

        <?php if ($this->options->navSwitch == '1' && $this->options->navCards): ?>
            <div class="nav-cards">
                <?php
                $navData = json_decode($this->options->navCards, true);
                if (is_array($navData)):
                    foreach ($navData as $nav):
                ?>
                    <a href="<?php echo $nav['link']; ?>" class="nav-card" target="_blank">
                        <div class="nav-card-icon">
                            <i class="<?php echo $nav['icon']; ?>"></i>
                        </div>
                        <div class="nav-card-content">
                            <h4><?php echo $nav['title']; ?></h4>
                            <p><?php echo $nav['desc']; ?></p>
                        </div>
                        <div class="nav-card-arrow">
                            <i class="fas fa-angle-right"></i>
                        </div>
                    </a>
                <?php
                    endforeach;
                endif;
                ?>
            </div>
        <?php endif; ?>

        <div class="post-list">
            <?php while($this->next()): ?>
                <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
                    <?php if($this->fields->banner): ?>
                    <div class="post-banner">
                        <a href="<?php $this->permalink() ?>">
                            <img src="<?php echo $this->fields->banner; ?>" alt="<?php $this->title() ?>">
                        </a>
                    </div>
                    <?php endif; ?>
                    
                    <div class="post-content-wrapper">
                        <h2 class="post-title" itemprop="name headline">
                            <a itemtype="url" href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
                        </h2>
                        
                        <ul class="post-meta">
                            <li itemprop="author">
                                <i class="fas fa-user"></i>
                                <a href="<?php $this->author->permalink(); ?>"><?php $this->author(); ?></a>
                            </li>
                            <li>
                                <i class="fas fa-calendar"></i>
                                <time datetime="<?php $this->date('c'); ?>"><?php $this->date('Y-m-d'); ?></time>
                            </li>
                            <li>
                                <i class="fas fa-folder"></i>
                                <?php $this->category(','); ?>
                            </li>
                            <li>
                                <i class="fas fa-eye"></i>
                                <?php get_post_view($this); ?> 次阅读
                            </li>
                            <li>
                                <i class="fas fa-comments"></i>
                                <a href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('暂无评论', '1 条评论', '%d 条评论'); ?></a>
                            </li>
                        </ul>
                        
                        <div class="post-excerpt" itemprop="articleBody">
                            <?php
                            if ($this->fields->summary) {
                                echo $this->fields->summary;
                            } else {
                                $this->excerpt(150, '...');
                            }
                            ?>
                        </div>
                        
                        <div class="post-more">
                            <a href="<?php $this->permalink() ?>" class="btn">
                                阅读全文 <i class="fas fa-angle-right"></i>
                            </a>
                        </div>
                    </div>
                </article>
            <?php endwhile; ?>
        </div>

        <?php $this->pageNav(
            '<i class="fas fa-angle-left"></i>',
            '<i class="fas fa-angle-right"></i>',
            1,
            '...',
            array(
                'wrapTag' => 'ul',
                'wrapClass' => 'page-navigator',
                'itemTag' => 'li',
                'textTag' => 'span',
                'currentClass' => 'current',
                'prevClass' => 'prev',
                'nextClass' => 'next'
            )
        ); ?>
    </div>

    <?php $this->need('sidebar.php'); ?>
</div>

<?php $this->need('footer.php'); ?>
